package com.android.superli.btremote.bean;

import android.bluetooth.BluetoothDevice;
import android.text.TextUtils;


public class MBluetoothDevice implements Comparable<MBluetoothDevice> {
    public int type;  //是否已经连接
    public BluetoothDevice mBluetoothDevice;
    public int rssi;

    @Override
    public int compareTo(MBluetoothDevice o) {
        if (o.type - type != 0) {
            return o.type - type;
        } else {
            if (TextUtils.isEmpty(mBluetoothDevice.getName())) {
                return 1;
            } else if (TextUtils.isEmpty(o.mBluetoothDevice.getName())) {
                return -1;
            } else {
                return Integer.compare(o.rssi, rssi);
            }
        }
    }
}
